import request from '@/utils/request'

// 订单列表
export function listOrders(query) {
  return request({
    url: '/order/page',
    method: 'get',
    params: query
  })
}

// 获取订单详情
export function getOrder(id) {
  return request({
    url: `/order/${id}`,
    method: 'get'
  })
}

// 创建订单
export function addOrder(data) {
  return request({
    url: '/order',
    method: 'post',
    data: data
  })
}

// 更新订单状态
export function updateOrderStatus(id, status) {
  return request({
    url: '/order/status',
    method: 'put',
    params: {
      id,
      status
    }
  })
}

// 取消订单
export function cancelOrder(id) {
  return request({
    url: '/order/cancel',
    method: 'put',
    params: {
      id
    }
  })
}

// 获取团长订单
export function getLeaderOrders(leaderId, params) {
  return request({
    url: '/order/leader',
    method: 'get',
    params: {
      leaderId,
      ...params
    }
  })
}

// 导出订单
export function exportOrders() {
  return request({
    url: '/order/export',
    method: 'get',
    responseType: 'blob'
  })
} 